# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :login_xxx.py
# @Time      :2022/6/9 14:22
# @Author    :张志坤


# 强制登陆

from flask import g
from functools import wraps


def login_request(func):
    @wraps(func)
    def warp(*args, **kwargs):
        if g.user_id is not None:
            return func(*args, **kwargs)
        else:
            return {'msg': "请先登录"}, 401

    return warp
